package com.cskaoyan.controller;


import com.cskaoyan.bean.storage.Storage;
import com.cskaoyan.bean.vo.BaseRespVo;
import com.cskaoyan.service.AdminStorageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;
import java.util.UUID;

@RestController
@RequestMapping("admin/storage")
public class AdminStorageController {

    @Autowired
    AdminStorageService storageService;

    @RequestMapping("create/asd")
    public BaseRespVo create(MultipartFile file){
        Storage result = storageService.insertObject(file);

        if (result == null) {
            return BaseRespVo.fail();
        }
        return BaseRespVo.ok(result);
    }
}
